<?php
$app_path = Yii::app()->basePath;
$web_path = YiiBase::getPathOfAlias('webroot');

require_once($app_path."/vendors/Smarty/Smarty.class.php");
class SmartyController extends Smarty{
	
	protected static $_instance = NULL;
	
	static function getInstance(){
		if(self::$_instance == NULL){
			self::$_instance = new MySmarty();
		}
 		return self::$_instance;
 	}
 	
	function init(){
		Yii::registerAutoloader('smartyAutoload');
		parent::__construct();
	 	$app_path = Yii::app()->basePath;
	 	$web_path = YiiBase::getPathOfAlias('webroot');
	  	$this->template_dir = $web_path."/templates/";
		$this->compile_dir = $app_path."/views/templates_c/";
	 	$this->config_dir = $app_path."/config/";
		//$this->compile_check = true;
	 	$this->caching = false;
	 	$this->debugging = false;
	 	$this->cache_dir = './smarty_cache';
	 	$this->left_delimiter = "{#";
	 	$this->right_delimiter = "#}";
	 	$this->cache_lifetime = 60;
                $jses=array();
              
	 	$this->paramInit();
 	}
 	
 	function paramInit(){
 		$params = array();
 		$params = Yii::app()->params;
 		foreach ($params as $key=>$value){
 			$this->assign($key,$value);
 		}
                
 	}
}